package com.ewili.x.special.dao.inter;

import com.ewili.x.special.entity.Execs;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;

/**
 * @author wonder
 */
public interface ExecsDao extends JpaRepository<Execs, Long> {

    Boolean existsByCodeAndDateAndChangePeopleAndChangeStocksAndChangeReason(String code, Date date, String changePeople, Double changeStocks, String changeReason);

    @Query(value = "SELECT MAX(date) FROM Execs")
    Date findMaxDate();


    @Query("SELECT SUM(changeAmount) FROM Execs where code= ?1 and date=?2 GROUP BY code, date")
    Double sumAmountByDay(String code, Date date);
}
